/*
 * Copyright 2010 - 2011, The PLDesktop Development Team
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

#ifndef PL_C_CTYPE_H
#define PL_C_CTYPE_H

#if defined __cplusplus
extern "C" {
#endif

/**
 * Checks if parameter c is either a decimal digit or an uppercase or lowercase letter.
 *
 * @param c Character to be checked, casted as an int, or EOF.
 * @return A value different from zero (i.e., true) if indeed c is either a digit or a
 * letter. Zero (i.e., false) otherwise.
 */
int isalnum ( int c );

/**
 * Check the parameter c that it was a alphabetic character.
 *
 * @param c The character to test.
 * @return 0 if it was not a alphabetic character.
 */
int isalpha(int c);

/**
 * Checks if parameter c is a control character.
 *
 * @param c Character to be checked, casted to an int, or EOF.
 * @return A value different from zero (i.e., true) if indeed c is a control character.
 * Zero (i.e., false) otherwise.
 */
int iscntrl ( int c );

/**
 * Check if the parameter c is a digit character.
 *
 * @param c The character to test.
 * @return 0 if it was not a digit character.
 */
int isdigit(int c);

/**
 * Check if character has graphical representation
 * Checks if parameter c is a character with graphical representation. The characters
 * with graphical representation are all those characters than can be printed (as determined
 * by isprint) except for whitespace characters (like ' '), which are not considered isgraph
 * characters.
 *
 * @param c Character to be checked, casted to an int, or EOF.
 * @return A value different from zero (i.e., true) if indeed c has a graphical representation
 * as character. Zero (i.e., false) otherwise.
 */
int isgraph ( int c );

/**
 * Check if the parameter c is a lowercase character.
 *
 * @param c The character to test.
 * @return 0 if it was not a lowercase character.
 */
int islower(int c);

/**
 * Check if character is printable
 *
 * @param c Character to be checked, casted to an int, or EOF.
 * @return A value different from zero (i.e., true) if indeed c is a printable character.
 * Zero (i.e., false) otherwise.
 */
int isprint ( int c );

/**	
 * Check if character is a punctuation character
 *
 * @param c Character to be checked, casted to an int, or EOF.
 * @return A value different from zero (i.e., true) if indeed c is a punctuation character.
 * Zero (i.e., false) otherwise.
 */
int ispunct ( int c );

/**
 * Check if the paramter c is a white - space character.
 *
 * @note The characters that are tested are the ones from the following table:\n
 * '   '   (0x20)    space (SPC)\n
 * '\\t'   (0x09)    horizontal tab (TAB)\n
 * '\\n'   (0x0a)    newline (LF)\n
 * '\\v'   (0x0b)    vertical tab (VT)\n
 * '\\f'   (0x0c)    feed (FF)\n
 * '\\r'   (0x0d)    carriage return (CR)\n
 * @param c The character to test.
 * @return 0 if it was not a white - space character.
 */
int isspace(int c);

/**
 * Check if the parameter c is a uppercase character.
 *
 * @param c The character to test.
 * @return 0 if it was not a uppercase character.
 */
int isupper(int c);

/**
 * Check if character is hexadecimal digit<br>
 * Checks if parameter c is a hexdecimal digit character.<br>
 * Hexadecimal digits are any of: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F<br>
 * For a detailed chart on what the different ctype functions return for each character of the
 * standard ANSII character set, see the reference for the cctype header.<br>
 * In C++, a locale-specific template version of this function (isxdigit) exists in header locale
 *
 * @param c Character to be checked, casted to an int, or EOF.
 * @return A value different from zero (i.e., true) if indeed c is a hexadecimal digit. Zero (i.e., false) otherwise.
 */
int isxdigit(int c);

/**
 * Convert lowercase letter to uppercase<br>
 * Converts parameter c to its uppercase equivalent if c is a lowercase letter and has an uppercase equivalent.
 * If no such conversion is possible, the value returned is c unchanged.<br>
 * Notice that what is considered a letter may depend on the locale being used; In the default C locale, a
 * lowercase letter is any of: a b c d e f g h i j k l m n o p q r s t u v w x y z, which translate respectively
 * to: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.<br>
 * In C++, a locale-specific template version of this function (toupper) exists in header locale
 *
 * @param c Lowercase letter character to be converted, casted to an int, or EOF.
 * @return The uppercase equivalent to c, if such value exists, or c (unchanged) otherwise. The value is
 * returned as an int value that can be implicitly casted to char.
 */
int toupper(int c);
	
#if defined __cplusplus
}
#endif

#endif // PL_C_CTYPE_H
